function isVaild(string){
    if(!string){
        return false
    }
    const leftToRight={
        '{':'}',
        '[':']',
        '(':')'
    }
    const stack =[]
    for (let index = 0; index < string.length; index++) {
        const ch = string[index];
      if(ch==='{'||ch==='['||ch==='(')stack.push(leftToRight[ch])
      else{
          if(!stack.length||stack.pop()!==ch){
              return false
          }
      }     
        
    }
    return !stack.length
}
console.log(isVaild('({[]})'));